/// <reference path="../types.ts" />
/// <reference path="../helpers.ts" />
/// <reference path="organization.ts" />

module $Xrm.Messages {
    export class ExecuteWorkflowRequest extends OrganizationRequest {
        public EntityId: string = null;
        public WorkflowId: string = null;

        constructor() {
            super("ExecuteWorkflow", "b");
        }

        GetResponse(responseXml: Document): ExecuteWorkflowResponse {
            return new ExecuteWorkflowResponse(responseXml);
        }

        ToSoapXml(): string {
            this.Parameters["EntityId"] = this.EntityId;
            this.Parameters["WorkflowId"] = this.WorkflowId;

            return super.ToSoapXml();
        }
    }

    export class ExecuteWorkflowResponse extends OrganizationResponse {
        public Id: string;

        constructor(responseXml?: Document) {
            super("ExecuteWorkflowResponse", responseXml);

            this.BindProperties();
        }

        BindProperties(): void {
            super.BindProperties();

            this.Id = this.Results["Id"];
        }
    }
}